package com.qupeng.demo.kafka.kafkaspringbootproducer.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Component
@ConfigurationProperties(prefix = "app.kafka")
public class KafkaProperties {
    @Value("${app.kafka.bootstrap-servers}")
    private String bootstrapServer;
    @Value("${app.kafka.producer.key-serializer-int}")
    private String keySerializerInt;
    @Value("${app.kafka.producer.value-serializer-str}")
    private String valueSerializerStr;
    @Value("${app.kafka.producer.value-serializer-json}")
    private String valueSerializerJson;
    @Value("${app.kafka.producer.value-serializer-avro:}")
    private String valueSerializerAvro;
    @Value("${app.kafka.security-protocol:}")
    private String securityProtocol;
    @Value("${app.kafka.ssl-keystore-location:}")
    private String sslKeystoreLocation;
    @Value("${app.kafka.ssl-keystore-password:}")
    private String sslKeystorePassword;
    @Value("${app.kafka.ssl-keystore-type:}")
    private String sslKeystoreType;
    @Value("${app.kafka.ssl-key-password:}")
    private String sslKeyPassword;
    @Value("${app.kafka.ssl-truststore-location:}")
    private String sslTruststoreLocation;
    @Value("${app.kafka.ssl-truststore-password:}")
    private String sslTruststorePassword;
    @Value("${app.kafka.ssl-truststore-type:}")
    private String sslTruststoreType;
    private List<String> topics;
    @Value("${app.kafka.serialization.format}")
    private String serializationFormat;
    @Value("${app.kafka.serialization.avro.schema-registry-url:}")
    private String schemaRegistryUrl;
    @Value("${app.kafka.ssl-keystore-location:}")
    private Resource keystore;
    @Value("${app.kafka.ssl-truststore-location:}")
    private Resource truststore;
    @Value("${app.kafka.sasl.mechanism:}")
    private String saslMechanism;
    @Value("${app.kafka.sasl.jaas.config:}")
    private String saslJaasConfig;

    public String getBootstrapServer() {
        return bootstrapServer;
    }

    public String getKeySerializerInt() {
        return keySerializerInt;
    }

    public String getValueSerializerStr() {
        return valueSerializerStr;
    }

    public String getValueSerializerJson() {
        return valueSerializerJson;
    }

    public String getValueSerializerAvro() {
        return valueSerializerAvro;
    }

    public String getSecurityProtocol() {
        return securityProtocol;
    }

    public String getSslKeystoreLocation() {
        return sslKeystoreLocation;
    }

    public String getSslKeystorePassword() {
        return sslKeystorePassword;
    }

    public String getSslTruststoreLocation() {
        return sslTruststoreLocation;
    }

    public String getSslTruststorePassword() {
        return sslTruststorePassword;
    }

    public List<String> getTopics() {
        return topics;
    }

    public String getSerializationFormat() {
        return serializationFormat;
    }

    public String getSchemaRegistryUrl() {
        return schemaRegistryUrl;
    }

    public Resource getKeystore() {
        return keystore;
    }

    public Resource getTruststore() {
        return truststore;
    }

    public String getSaslMechanism() {
        return saslMechanism;
    }

    public String getSaslJaasConfig() {
        return saslJaasConfig;
    }

    public String getSslKeystoreType() {
        return sslKeystoreType;
    }

    public String getSslKeyPassword() {
        return sslKeyPassword;
    }

    public String getSslTruststoreType() {
        return sslTruststoreType;
    }
}
